home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / emacs.lha / emacs-19.16 / info / emacs-4 (.txt) < prev    next >
GNU Info File  |  1993-07-06  |  49KB  |  899 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3. File: emacs,  Node: Apropos,  Next: Library Keywords,  Prev: Name Help,  Up: Help
  4. Apropos
  5. =======
  6.    A more sophisticated sort of question to ask is, "What are the
  7. commands for working with files?"  To ask this question, type `C-h a
  8. file RET', which displays a list of all command names that contain
  9. `file', including `copy-file', `find-file', and so on.  With each
  10. command name appears a brief description of how to use the command, and
  11. what keys you can currently invoke it with.  For example, it would say
  12. that you can invoke `find-file' by typing `C-x C-f'.  The `a' in `C-h
  13. a' stands for `Apropos'; `C-h a' runs the command `command-apropos'.
  14.    Because `C-h a' looks only for functions whose names contain the
  15. string which you specify, you must use ingenuity in choosing the
  16. string.  If you are looking for commands for killing backwards and `C-h
  17. a kill-backwards RET' doesn't reveal any, don't give up.  Try just
  18. `kill', or just `backwards', or just `back'.  Be persistent.  Also note
  19. that you can use a regular expression as the argument, for more
  20. flexibility (*note Regexps::.).
  21.    Here is a set of arguments to give to `C-h a' that covers many
  22. classes of Emacs commands, since there are strong conventions for naming
  23. the standard Emacs commands.  By giving you a feel for the naming
  24. conventions, this set should also serve to aid you in developing a
  25. technique for picking `apropos' strings.
  26.      char, line, word, sentence, paragraph, region, page, sexp, list,
  27.      defun, rect, buffer, frame, window, file, dir, register, mode,
  28.      beginning, end, forward, backward, next, previous, up, down,
  29.      search, goto, kill, delete, mark, insert, yank, fill, indent,
  30.      case, change, set, what, list, find, view, describe.
  31.    To list all Lisp symbols that contain a match for a regexp, not just
  32. the ones that are defined as commands, use the command `M-x apropos'
  33. instead of `C-h a'.  This command does not check key bindings by
  34. default; specify a numeric argument if you want it to check them.
  35.    The `super-apropos' command is like `apropos' except that it
  36. searches documentation strings as well as symbol names for matches for
  37. the specified regular expression.
  38. File: emacs,  Node: Library Keywords,  Next: Misc Help,  Prev: Apropos,  Up: Help
  39. Keyword Search for Lisp Libraries
  40. =================================
  41.    The `C-h p' command lets you search the standard Emacs Lisp
  42. libraries by topic keywords.  Here is a partial list of keywords you can
  43. `abbrev'
  44.      Abbreviation handling, typing shortcuts, macros.
  45. `bib'
  46.      Support for the bibliography processor `bib'.
  47.      C and C++ language support.
  48. `calendar'
  49.      Calendar and time management support.
  50. `comm'
  51.      Communications, networking, remote access to files.
  52. `docs'
  53.      Support for Emacs documentation.
  54. `emulations'
  55.      Emulations of other editors.
  56. `extensions'
  57.      Emacs Lisp language extensions.
  58. `faces'
  59.      Support for using faces (fonts and colors; *note Faces::.).
  60. `games'
  61.      Games, jokes and amusements.
  62. `hardware'
  63.      Support for interfacing with exotic hardware.
  64. `help'
  65.      Support for on-line help systems.
  66. `i18n'
  67.      Internationalization and alternate character-set support.
  68. `internal'
  69.      Code for Emacs internals, build process, defaults.
  70. `languages'
  71.      Specialized modes for editing programming languages.
  72. `lisp'
  73.      Support for using Lisp (including Emacs Lisp).
  74. `local'
  75.      Libraries local to your site.
  76. `maint'
  77.      Maintenance aids for the Emacs development group.
  78. `mail'
  79.      Modes for electronic-mail handling.
  80. `news'
  81.      Support for netnews reading and posting.
  82. `non-text'
  83.      Support for editing files that are not ordinary text.
  84. `processes'
  85.      Process, subshell, compilation, and job control support.
  86. `terminals'
  87.      Support for terminal types.
  88. `tex'
  89.      Support for the TeX formatter.
  90. `tools'
  91.      Programming tools.
  92. `unix'
  93.      Front-ends/assistants for, or emulators of, Unix features.
  94. `vms'
  95.      Support code for VMS.
  96.      Word processing.
  97. File: emacs,  Node: Misc Help,  Prev: Library Keywords,  Up: Help
  98. Other Help Commands
  99. ===================
  100.    `C-h i' (`info') runs the Info program, which is used for browsing
  101. through structured documentation files.  The entire Emacs manual is
  102. available within Info.  Eventually all the documentation of the GNU
  103. system will be available.  Type `h' after entering Info to run a
  104. tutorial on using Info.
  105.    There are two special help commands for accessing Emacs documentation
  106. through Info.  `C-h C-f FUNCTION RET' enters Info and goes straight to
  107. the documentation of the Emacs function FUNCTION.  `C-h C-k KEY' enters
  108. Info and goes straight to the documentation of the key KEY.  These two
  109. keys run the commands `Info-goto-emacs-command-node' and
  110. `Info-goto-emacs-key-command-node'.
  111.    If something surprising happens, and you are not sure what commands
  112. you typed, use `C-h l' (`view-lossage').  `C-h l' prints the last 100
  113. command characters you typed in.  If you see commands that you don't
  114. know, you can use `C-h c' to find out what they do.
  115.    Emacs has numerous major modes, each of which redefines a few keys
  116. and makes a few other changes in how editing works.  `C-h m'
  117. (`describe-mode') prints documentation on the current major mode, which
  118. normally describes all the commands that are changed in this mode.
  119.    `C-h b' (`describe-bindings') and `C-h s' (`describe-syntax')
  120. present other information about the current Emacs mode.  `C-h b'
  121. displays a list of all the key bindings now in effect; the local
  122. bindings defined by the current minor modes first, then the local
  123. bindings defined by the current major mode, and finally the global
  124. bindings (*note Key Bindings::.).  `C-h s' displays the contents of the
  125. syntax table, with explanations of each character's syntax (*note
  126. Syntax::.).
  127.    The other `C-h' options display various files of useful information.
  128. `C-h C-w' displays the full details on the complete absence of warranty
  129. for GNU Emacs.  `C-h n' (`view-emacs-news') displays the file
  130. `emacs/etc/NEWS', which contains documentation on Emacs changes
  131. arranged chronologically.  `C-h t' (`help-with-tutorial') displays the
  132. learn-by-doing Emacs tutorial.  `C-h C-c' (`describe-copying') displays
  133. the file `emacs/etc/COPYING', which tells you the conditions you must
  134. obey in distributing copies of Emacs.  `C-h C-d'
  135. (`describe-distribution') displays the file `emacs/etc/DISTRIB', which
  136. tells you how you can order a copy of the latest version of Emacs.
  137. File: emacs,  Node: Mark,  Next: Killing,  Prev: Help,  Up: Top
  138. The Mark and the Region
  139. ***********************
  140.    There are many Emacs commands which operate on an arbitrary
  141. contiguous part of the current buffer.  To specify the text for such a
  142. command to operate on, you set "the mark" at one end of it, and move
  143. point to the other end.  The text between point and the mark is called
  144. "the region".  You can move point or the mark to adjust the boundaries
  145. of the region.  It doesn't matter which one is set first
  146. chronologically, or which one comes earlier in the text.
  147.    Once the mark has been set, it remains where you put it until it is
  148. set again at another place.  The mark remains fixed with respect to the
  149. preceding character if text is inserted or deleted in the buffer.  Each
  150. Emacs buffer has its own mark, so that when you return to a buffer that
  151. had been selected previously, it has the same mark it had before.
  152.    Many commands that insert text, such as `C-y' (`yank') and `M-x
  153. insert-buffer', position point and the mark at opposite ends of the
  154. inserted text, so that the region contains the text just inserted.
  155.    Aside from delimiting the region, the mark is also useful for
  156. remembering a spot that you may want to go back to.  To make this
  157. feature more useful, each buffer remembers 16 previous locations of the
  158. mark in the "mark ring".
  159. * Menu:
  160. * Setting Mark::    Commands to set the mark.
  161. * Transient Mark::    How to make Emacs highlight the region-
  162.               when there is one.
  163. * Using Region::    Summary of ways to operate on contents of the region.
  164. * Marking Objects::    Commands to put region around textual units.
  165. * Mark Ring::   Previous mark positions saved so you can go back there.
  166. File: emacs,  Node: Setting Mark,  Next: Transient Mark,  Up: Mark
  167. Setting the Mark
  168. ================
  169.    Here are some commands for setting the mark:
  170. `C-SPC'
  171.      Set the mark where point is (`set-mark-command').
  172. `C-@'
  173.      The same.
  174. `C-x C-x'
  175.      Interchange mark and point (`exchange-point-and-mark').
  176.    For example, suppose you wish to convert part of the buffer to all
  177. upper-case, using the `C-x C-u' (`upcase-region') command which
  178. operates on the text in the region.  You can first go to the beginning
  179. of the text to be capitalized, type `C-SPC' to put the mark there, move
  180. to the end, and then type `C-x C-u'.  Or, you can set the mark at the
  181. end of the text, move to the beginning, and then type `C-x C-u'.
  182.    The most common way to set the mark is with the `C-SPC' command
  183. (`set-mark-command').  This sets the mark where point is.  Then you can
  184. move point away, leaving the mark behind.
  185.    Ordinary terminals have only one cursor, so there is no way for Emacs
  186. to show you where the mark is located.  You have to remember.  The usual
  187. solution to this problem is to set the mark and then use it soon, before
  188. you forget where it is.  Alternatively, you can see where the mark is
  189. with the command `C-x C-x' (`exchange-point-and-mark') which puts the
  190. mark where point was and point where the mark was.  The extent of the
  191. region is unchanged, but the cursor and point are now at the previous
  192. position of the mark.
  193.    `C-x C-x' is also useful when you are satisfied with the position of
  194. point but want to move the mark; do `C-x C-x' to put point at that end
  195. of the region, and then move it.  A second use of `C-x C-x', if
  196. necessary, puts the mark at the new position with point back at its
  197. original position.
  198.    There is no such character as `C-SPC' in ASCII; when you type SPC
  199. while holding down CTRL, what you get on most ordinary terminals is the
  200. character `C-@'.  This key is actually bound to `set-mark-command'.
  201. But unless you are unlucky enough to have a terminal where typing
  202. `C-SPC' does not produce `C-@', you might as well think of this
  203. character as `C-SPC'.  Under X, `C-SPC' is actually a distinct
  204. character, but its binding is still `set-mark-command'.
  205. File: emacs,  Node: Transient Mark,  Next: Using Region,  Prev: Setting Mark,  Up: Mark
  206. Transient Mark Mode
  207. ===================
  208.    Many Emacs commands move the mark and invisibly set new regions.
  209. This means that there is almost always some region that you can act on.
  210. This is convenient, provided you get used to keeping track of the
  211. mark's position.
  212.    Some people prefer a more rigid mode of operation in which you must
  213. set up a region for each command that uses one--in which the region
  214. "lasts" only temporarily.  This is called Transient Mark mode.  It is
  215. particularly well-suited to window systems such as X, since Emacs can
  216. highlight the region when it is active.
  217.    To enable Transient Mark mode, type `M-x transient-mark-mode'.  This
  218. command toggles the mode, so you can issue it again to return to the
  219. normal Emacs way of handling the mark and the region.
  220.    Here are the details of Transient Mark mode:
  221.    * To set the mark, type `C-SPC' (`set-mark-command').  This makes
  222.      the mark active; as you move point, you will see the region
  223.      highlighting change in extent.
  224.    * On a window system, an easy way to select a region is to press the
  225.      button Mouse-1 (normally the left button) at one end of it, drag
  226.      the mouse to the other end, and then release the button.
  227.    * When the mark is active, you can execute any commands you want on
  228.      the region, such as killing, indentation, or writing to a file.
  229.    * Any change to the buffer, such as inserting or deleting a
  230.      character, deactivates the mark.  This means any subsequent
  231.      command that operates on a region will get an error and refuse to
  232.      operate.  You can make the region active again by typing `C-x C-x'.
  233.    * Commands like `M->' that "leave the mark behind" do not activate
  234.      the new mark.  it.  You can activate the new region by executing
  235.      `C-x C-x' (`exchange-point-and-mark').
  236.    * Quitting with `C-g' deactivates the mark.
  237.    Transient Mark mode is also sometimes known as "Zmacs mode" because
  238. the Zmacs editor on the MIT Lisp Machine handled the mark in a similar
  239.    When multiple windows show the same buffer, they can have different
  240. regions, because they can have different values of point.  In Transient
  241. Mark mode, each window highlights its own region.  The part that is
  242. highlighted in the selected window is the region that editing commands
  243. use.  *Note Windows::.
  244. File: emacs,  Node: Using Region,  Next: Marking Objects,  Prev: Transient Mark,  Up: Mark
  245. Operating on the Region
  246. =======================
  247.    Once you have set up a region and the mark is active, you can do many
  248. things to the text in it:
  249.    * Kill it with `C-w' (*note Killing::.).
  250.    * Save it in a register with `C-x r s' (*note Registers::.).
  251.    * Save it in a buffer or a file (*note Accumulating Text::.).
  252.    * Convert case with `C-x C-l' or `C-x C-u' (*note Case::.).
  253.    * Indent it with `C-x TAB' or `C-M-\' (*note Indentation::.).
  254.    * Fill it as text with `M-x fill-region' (*note Filling::.).
  255.    * Print hardcopy with `M-x print-region' (*note Hardcopy::.).
  256.    * Evaluate it as Lisp code with `M-x eval-region' (*note Lisp
  257.      Eval::.).
  258.    Most commands that operate on the text in the region have the word
  259. `region' in their names.
  260. File: emacs,  Node: Marking Objects,  Next: Mark Ring,  Prev: Using Region,  Up: Mark
  261. Commands to Mark Textual Objects
  262. ================================
  263.    Here are the commands for placing point and the mark around a textual
  264. object such as a word, list, paragraph or page.
  265. `M-@'
  266.      Set mark after end of next word (`mark-word').  This command and
  267.      the following one do not move point.
  268. `C-M-@'
  269.      Set mark after end of next Lisp expression (`mark-sexp').
  270. `M-h'
  271.      Put region around current paragraph (`mark-paragraph').
  272. `C-M-h'
  273.      Put region around current Lisp defun (`mark-defun').
  274. `C-x h'
  275.      Put region around entire buffer (`mark-whole-buffer').
  276. `C-x C-p'
  277.      Put region around current page (`mark-page').
  278.    `M-@' (`mark-word') puts the mark at the end of the next word, while
  279. `C-M-@' (`mark-sexp') puts it at the end of the next Lisp expression.
  280. These commands handle arguments just like `M-f' and `C-M-f'.
  281.    Other commands set both point and mark, to delimit an object in the
  282. buffer.  For example, `M-h' (`mark-paragraph') moves point to the
  283. beginning of the paragraph that surrounds or follows point, and puts
  284. the mark at the end of that paragraph (*note Paragraphs::.).  It
  285. prepares the region so you can indent, case-convert, or kill a whole
  286. paragraph.
  287.    `C-M-h' (`mark-defun') similarly puts point before and the mark
  288. after the current or following defun (*note Defuns::.).  `C-x C-p'
  289. (`mark-page') puts point before the current page, and mark at the end
  290. (*note Pages::.).  The mark goes after the terminating page delimiter
  291. (to include it), while point goes after the preceding page delimiter
  292. (to exclude it).  A numeric argument specifies a later page (if
  293. positive) or an earlier page (if negative) instead of the current page.
  294.    Finally, `C-x h' (`mark-whole-buffer') sets up the entire buffer as
  295. the region, by putting point at the beginning and the mark at the end.
  296. File: emacs,  Node: Mark Ring,  Prev: Marking Objects,  Up: Mark
  297. The Mark Ring
  298. =============
  299.    Aside from delimiting the region, the mark is also useful for
  300. remembering a spot that you may want to go back to.  To make this
  301. feature more useful, each buffer remembers 16 previous locations of the
  302. mark, in the "mark ring".  Commands that set the mark also push the old
  303. mark onto this ring.  To return to a marked location, use `C-u C-SPC'
  304. (or `C-u C-@'); this is the command `set-mark-command' given a numeric
  305. argument.  It moves point to where the mark was, and restores the mark
  306. from the ring of former marks.  Thus, repeated use of this command
  307. moves point to all of the old marks on the ring, one by one.  The mark
  308. positions you move through in this way are not lost; they go to the end
  309. of the ring.
  310.    Each buffer has its own mark ring.  All editing commands use the
  311. current buffer's mark ring.  In particular, `C-u C-SPC' always stays in
  312. the same buffer.
  313.    Many commands that can move long distances, such as `M-<'
  314. (`beginning-of-buffer'), start by setting the mark and saving the old
  315. mark on the mark ring.  This is to make it easier for you to move back
  316. later.  Searches set the mark if they move point.  You can tell when a
  317. command sets the mark because it displays `Mark Set' in the echo area.
  318.    If you want to move back to the same place over and over, the mark
  319. ring may not be convenient enough.  If so, you can record the position
  320. in a register for later retrieval (*note RegPos::.).
  321.    The variable `mark-ring-max' specifies the maximum number of entries
  322. to keep in the mark ring.  If that many entries exist and another one
  323. is pushed, the last one in the list is discarded.  Repeating `C-u
  324. C-SPC' circulates through the positions currently in the ring.
  325.    The variable `mark-ring' holds the mark ring itself, as a list of
  326. marker objects in the order most recent first.  This variable is local
  327. in every buffer.
  328. File: emacs,  Node: Killing,  Next: Yanking,  Prev: Mark,  Up: Top
  329. Deletion and Killing
  330. ====================
  331.    Most commands which erase text from the buffer save it in the kill
  332. ring so that you can move or copy it to other parts of the buffer.
  333. These commands are known as "kill" commands.  The rest of the commands
  334. that erase text do not save it in the kill ring; they are known as
  335. "delete" commands.  (This distinction is made only for erasure of text
  336. in the buffer.)  If you do a kill or delete command by mistake, you can
  337. use the `C-x u' (`undo') command to undo it (*note Undo::.).
  338.    The delete commands include `C-d' (`delete-char') and DEL
  339. (`delete-backward-char'), which delete only one character at a time,
  340. and those commands that delete only spaces or newlines.  Commands that
  341. can destroy significant amounts of nontrivial data generally kill.  The
  342. commands' names and individual descriptions use the words `kill' and
  343. `delete' to say which they do.
  344.    You can use kill commands in read-only buffers.  They don't actually
  345. change the buffer, and they beep to warn you of that, but they do copy
  346. the text you tried to kill into the kill ring, so you can yank it into
  347. other buffers.
  348. * Menu:
  349. * Deletion::            Commands for deleting small amounts of text and
  350.                           blank areas.
  351. * Killing by Lines::    How to kill entire lines of text at one time.
  352. * Other Kill Commands:: Commands to kill large regions of text and
  353.                           syntactic units such as words and sentences.
  354. File: emacs,  Node: Deletion,  Next: Killing by Lines,  Up: Killing
  355. Deletion
  356. --------
  357. `C-d'
  358.      Delete next character (`delete-char').
  359. `DEL'
  360.      Delete previous character (`delete-backward-char').
  361. `M-\'
  362.      Delete spaces and tabs around point (`delete-horizontal-space').
  363. `M-SPC'
  364.      Delete spaces and tabs around point, leaving one space
  365.      (`just-one-space').
  366. `C-x C-o'
  367.      Delete blank lines around the current line (`delete-blank-lines').
  368. `M-^'
  369.      Join two lines by deleting the intervening newline, along with any
  370.      indentation following it (`delete-indentation').
  371.    The most basic delete commands are `C-d' (`delete-char') and DEL
  372. (`delete-backward-char').  `C-d' deletes the character after point, the
  373. one the cursor is "on top of".  This doesn't move point.  DEL deletes
  374. the character before the cursor, and moves point back.  You can delete
  375. newlines like any other characters in the buffer; deleting a newline
  376. joins two lines.  Actually, `C-d' and DEL aren't always delete
  377. commands; when given arguments, they kill instead, since they can erase
  378. more than one character this way.
  379.    The other delete commands are those which delete only whitespace
  380. characters: spaces, tabs and newlines.  `M-\'
  381. (`delete-horizontal-space') deletes all the spaces and tab characters
  382. before and after point.  `M-SPC' (`just-one-space') does likewise but
  383. leaves a single space after point, regardless of the number of spaces
  384. that existed previously (even zero).
  385.    `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
  386. current line.  If the current line is blank, it deletes all blank lines
  387. preceding the current line as well (leaving one blank line, the current
  388. line).
  389.    `M-^' (`delete-indentation') joins the current line and the previous
  390. line, by deleting a newline and all surrounding spaces, usually leaving
  391. a single space.  *Note M-^: Indentation.
  392. File: emacs,  Node: Killing by Lines,  Next: Other Kill Commands,  Prev: Deletion,  Up: Killing
  393. Killing by Lines
  394. ----------------
  395. `C-k'
  396.      Kill rest of line or one or more lines (`kill-line').
  397.    The simplest kill command is `C-k'.  If given at the beginning of a
  398. line, it kills all the text on the line, leaving it blank.  When used
  399. on a blank line, it kills the whole line including its newline.  To kill
  400. an entire non-blank line, go to the beginning and type `C-k' twice.
  401.    More generally, `C-k' kills from point up to the end of the line,
  402. unless it is at the end of a line.  In that case it kills the newline
  403. following point, thus merging the next line into the current one.
  404. Spaces and tabs that you can't see at the end of the line are ignored
  405. when deciding which case applies, so if point appears to be at the end
  406. of the line, you can be sure `C-k' will kill the newline.
  407.    When `C-k' is given a positive argument, it kills that many lines
  408. and the newlines that follow them (however, text on the current line
  409. before point is spared).  With a negative argument -N, it kills N lines
  410. preceding the current line (together with the text on the current line
  411. before point).  Thus, `C-u - 2 C-k' at the front of a line kills the
  412. two previous lines.
  413.    `C-k' with an argument of zero kills the text before point on the
  414. current line.
  415.    If the variable `kill-whole-line' is non-`nil', `C-k' at the very
  416. beginning of a line kills the entire line including the following
  417. newline.  This variable is normally `nil'.
  418. File: emacs,  Node: Other Kill Commands,  Prev: Killing by Lines,  Up: Killing
  419. Other Kill Commands
  420. -------------------
  421. `C-w'
  422.      Kill region (from point to the mark) (`kill-region').
  423. `M-d'
  424.      Kill word (`kill-word').  *Note Words::.
  425. `M-DEL'
  426.      Kill word backwards (`backward-kill-word').
  427. `C-x DEL'
  428.      Kill back to beginning of sentence (`backward-kill-sentence').
  429.      *Note Sentences::.
  430. `M-k'
  431.      Kill to end of sentence (`kill-sentence').
  432. `C-M-k'
  433.      Kill sexp (`kill-sexp').  *Note Lists::.
  434. `M-z CHAR'
  435.      Kill through the next occurrence of CHAR (`zap-to-char').
  436.    A kill command which is very general is `C-w' (`kill-region'), which
  437. kills everything between point and the mark.  With this command, you
  438. can kill any contiguous sequence of characters, if you first set the
  439. region around them.
  440.    A convenient way of killing is combined with searching: `M-z'
  441. (`zap-to-char') reads a character and kills from point up to (and
  442. including) the next occurrence of that character in the buffer.  A
  443. numeric argument acts as a repeat count.  A negative argument means to
  444. search backward and kill text before point.
  445.    Other syntactic units can be killed: words, with `M-DEL' and `M-d'
  446. (*note Words::.); sexps, with `C-M-k' (*note Lists::.); and sentences,
  447. with `C-x DEL' and `M-k' (*note Sentences::.).
  448. File: emacs,  Node: Yanking,  Next: Accumulating Text,  Prev: Killing,  Up: Top
  449. Yanking
  450. =======
  451.    "Yanking" means reinserting text previously killed.  This is what
  452. some systems call "pasting".  The usual way to move or copy text is to
  453. kill it and then yank it elsewhere one or more times.
  454. `C-y'
  455.      Yank last killed text (`yank').
  456. `M-y'
  457.      Replace text just yanked with an earlier batch of killed text
  458.      (`yank-pop').
  459. `M-w'
  460.      Save region as last killed text without actually killing it
  461.      (`kill-ring-save').
  462. `C-M-w'
  463.      Append next kill to last batch of killed text (`append-next-kill').
  464. * Menu:
  465. * Kill Ring::       Where killed text is stored.  Basic yanking.
  466. * Appending Kills:: Several kills in a row all yank together.
  467. * Earlier Kills::   Yanking something killed some time ago.
  468. File: emacs,  Node: Kill Ring,  Next: Appending Kills,  Up: Yanking
  469. The Kill Ring
  470. -------------
  471.    All killed text is recorded in the "kill ring", a list of blocks of
  472. text that have been killed.  There is only one kill ring, used in all
  473. buffers, so you can kill text in one buffer and yank it in another
  474. buffer.  This is the usual way to move text from one file to another.
  475. (*Note Accumulating Text::, for some other ways.)
  476.    The command `C-y' (`yank') reinserts the text of the most recent
  477. kill.  It leaves the cursor at the end of the text.  It sets the mark at
  478. the beginning of the text.  *Note Mark::.
  479.    `C-u C-y' leaves the cursor in front of the text, and sets the mark
  480. after it.  This is only if the argument is specified with just a `C-u',
  481. precisely.  Any other sort of argument, including `C-u' and digits,
  482. specifies an earlier kill to yank (*note Earlier Kills::.).
  483.    If you wish to copy a block of text, you might want to use `M-w'
  484. (`kill-ring-save'), which copies the region into the kill ring without
  485. removing it from the buffer.  This is approximately equivalent to `C-w'
  486. followed by `C-x u', except that `M-w' does not alter the undo history
  487. and does not temporarily change the screen.
  488. File: emacs,  Node: Appending Kills,  Next: Earlier Kills,  Prev: Kill Ring,  Up: Yanking
  489. Appending Kills
  490. ---------------
  491.    Normally, each kill command pushes a new entry onto the kill ring.
  492. However, two or more kill commands in a row combine their text into a
  493. single entry, so that a single `C-y' gets it all back as it was before
  494. it was killed.
  495.    Thus, if you want to yank text as a unit, you need not kill all of it
  496. with one command; you can keep killing line after line, or word after
  497. word, until you have killed it all, and you can still get it all back at
  498. once.
  499.    Commands that kill forward from point add onto the end of the
  500. previous killed text.  Commands that kill backward from point add text
  501. onto the beginning.  This way, any sequence of mixed forward and
  502. backward kill commands puts all the killed text into one entry without
  503. rearrangement.  Numeric arguments do not break the sequence of
  504. appending kills.  For example, suppose the buffer contains
  505.      This is a line -!-of sample text.
  506. with point as shown.  If you type `M-d M-DEL M-d M-DEL', killing
  507. alternately forward and backward, you end up with `a line of sample' as
  508. one entry in the kill ring, and `This is text.' in the buffer.  (Note
  509. the double space, which you can clean up with `M-SPC' or `M-q'.)
  510.    Another way to kill the same text is to move back two words with
  511. `M-b M-b', then kill all four words forward with `C-u M-d'.  This
  512. produces exactly the same results in the buffer and in the kill ring.
  513. `M-f M-f C-u M-DEL' kills the same text, all going backward; once
  514. again, the result is the same.  The text in the kill ring entry always
  515. has the same order that it had in the buffer before you killed it.
  516.    If a kill command is separated from the last kill command by other
  517. commands (not just numeric arguments), it starts a new entry on the kill
  518. ring.  But you can force it to append by first typing the command
  519. `C-M-w' (`append-next-kill') right before it.  The `C-M-w' tells the
  520. following command, if it is a kill command, to append the text it kills
  521. to the last killed text, instead of starting a new entry.  With
  522. `C-M-w', you can kill several separated pieces of text and accumulate
  523. them to be yanked back in one place.
  524. File: emacs,  Node: Earlier Kills,  Prev: Appending Kills,  Up: Yanking
  525. Yanking Earlier Kills
  526. ---------------------
  527.    To recover killed text that is no longer the most recent kill, use
  528. the `M-y' command (`yank-pop').  It takes the text previously yanked
  529. and replaces it with the text from an earlier kill.  So, to recover the
  530. text of the next-to-the-last kill, first use `C-y' to yank the last
  531. kill, and then use `M-y' to replace it with the previous kill.  `M-y'
  532. is allowed only after a `C-y' or another `M-y'.
  533.    You can understand `M-y' in terms of a "last yank" pointer which
  534. points at an entry in the kill ring.  Each time you kill, the "last
  535. yank" pointer moves to the newly made entry at the front of the ring.
  536. `C-y' yanks the entry which the "last yank" pointer points to.  `M-y'
  537. moves the "last yank" pointer to a different entry, and the text in the
  538. buffer changes to match.  Enough `M-y' commands can move the pointer to
  539. any entry in the ring, so you can get any entry into the buffer.
  540. Eventually the pointer reaches the end of the ring; the next `M-y'
  541. moves it to the first entry again.
  542.    `M-y' moves the "last yank" pointer around the ring, but it does not
  543. change the order of the entries in the ring, which always runs from the
  544. most recent kill at the front to the oldest one still remembered.
  545.    `M-y' can take a numeric argument, which tells it how many entries
  546. to advance the "last yank" pointer by.  A negative argument moves the
  547. pointer toward the front of the ring; from the front of the ring, it
  548. moves "around" to the last entry and continues forward from there.
  549.    Once the text you are looking for is brought into the buffer, you can
  550. stop doing `M-y' commands and it will stay there.  It's just a copy of
  551. the kill ring entry, so editing it in the buffer does not change what's
  552. in the ring.  As long as no new killing is done, the "last yank"
  553. pointer remains at the same place in the kill ring, so repeating `C-y'
  554. will yank another copy of the same previous kill.
  555.    If you know how many `M-y' commands it would take to find the text
  556. you want, you can yank that text in one step using `C-y' with a numeric
  557. argument.  `C-y' with an argument restores the text the specified
  558. number of entries back in the kill ring.  Thus, `C-u 2 C-y' gets the
  559. next to the last block of killed text.  It is equivalent to `C-y M-y'.
  560. `C-y' with a numeric argument starts counting from the "last yank"
  561. pointer, and sets the "last yank" pointer to the entry that it yanks.
  562.    The length of the kill ring is controlled by the variable
  563. `kill-ring-max'; no more than that many blocks of killed text are saved.
  564.    The actual contents of the kill ring are stored in a variable named
  565. `kill-ring'; you can view the entire contents of the kill ring with the
  566. command `C-h v kill-ring'.
  567. File: emacs,  Node: Accumulating Text,  Next: Rectangles,  Prev: Yanking,  Up: Top
  568. Accumulating Text
  569. =================
  570.    Usually we copy or move text by killing it and yanking it, but there
  571. are other methods convenient for copying one block of text in many
  572. places, or for copying many scattered blocks of text into one place.  To
  573. copy one block to many places, store it in a register (*note
  574. Registers::.).  Here we describe the commands to accumulate scattered
  575. pieces of text into a buffer or into a file.
  576. `M-x append-to-buffer'
  577.      Append region to contents of specified buffer.
  578. `M-x prepend-to-buffer'
  579.      Prepend region to contents of specified buffer.
  580. `M-x copy-to-buffer'
  581.      Copy region into specified buffer, deleting that buffer's old
  582.      contents.
  583. `M-x insert-buffer'
  584.      Insert contents of specified buffer into current buffer at point.
  585. `M-x append-to-file'
  586.      Append region to contents of specified file, at the end.
  587.    To accumulate text into a buffer, use `M-x append-to-buffer'.  This
  588. reads a buffer name, them inserts a copy of the region into the buffer
  589. specified.  If you specify a nonexistent buffer, `append-to-buffer'
  590. creates the buffer.  The text is inserted wherever point is in that
  591. buffer.  If you have been using the buffer for editing, the copied text
  592. goes into the middle of the text of the buffer, wherever point happens
  593. to be in it.
  594.    Point in that buffer is left at the end of the copied text, so
  595. successive uses of `append-to-buffer' accumulate the text in the
  596. specified buffer in the same order as they were copied.  Strictly
  597. speaking, `append-to-buffer' does not always append to the text already
  598. in the buffer--only if point in that buffer is at the end.  However, if
  599. `append-to-buffer' is the only command you use to alter a buffer, then
  600. point is always at the end.
  601.    `M-x prepend-to-buffer' is just like `append-to-buffer' except that
  602. point in the other buffer is left before the copied text, so successive
  603. prependings add text in reverse order.  `M-x copy-to-buffer' is similar
  604. except that any existing text in the other buffer is deleted, so the
  605. buffer is left containing just the text newly copied into it.
  606.    To retrieve the accumulated text from another buffer, use `M-x
  607. insert-buffer'; this too takes BUFFERNAME as an argument.  It inserts a
  608. copy of the text in buffer BUFFERNAME into the selected buffer.  You
  609. can alternatively select the other buffer for editing, then optionally
  610. move text from it by killing.  *Note Buffers::, for background
  611. information on buffers.
  612.    Instead of accumulating text within Emacs, in a buffer, you can
  613. append text directly into a file with `M-x append-to-file', which takes
  614. FILENAME as an argument.  It adds the text of the region to the end of
  615. the specified file.  The file is changed immediately on disk.
  616.    You should use `append-to-file' only with files that are *not* being
  617. visited in Emacs.  Using it on a file that you are editing in Emacs
  618. would change the file behind Emacs's back, which can lead to losing
  619. some of your editing.
  620. File: emacs,  Node: Rectangles,  Next: Registers,  Prev: Accumulating Text,  Up: Top
  621. Rectangles
  622. ==========
  623.    The rectangle commands operate on rectangular areas of the text: all
  624. the characters between a certain pair of columns, in a certain range of
  625. lines. Commands are provided to kill rectangles, yank killed rectangles,
  626. clear them out, fill them with blanks or text, or delete them. Rectangle
  627. commands are useful with text in multicolumn formats, and for changing
  628. text into or out of such formats.
  629.    When you must specify a rectangle for a command to work on, you do it
  630. by putting the mark at one corner and point at the opposite corner.  The
  631. rectangle thus specified is called the "region-rectangle" because you
  632. control it in about the same way the region is controlled.  But
  633. remember that a given combination of point and mark values can be
  634. interpreted either as a region or as a rectangle, depending on the
  635. command that uses them.
  636.    If point and the mark are in the same column, the rectangle they
  637. delimit is empty.  If they are in the same line, the rectangle is one
  638. line high.  This asymmetry between lines and columns comes about
  639. because point (and likewise the mark) is between two columns, but within
  640. a line.
  641. `C-x r k'
  642.      Kill the text of the region-rectangle, saving its contents as the
  643.      "last killed rectangle" (`kill-rectangle').
  644. `C-x r y'
  645.      Yank the last killed rectangle with its upper left corner at point
  646.      (`yank-rectangle').
  647. `C-x r o'
  648.      Insert blank space to fill the space of the region-rectangle
  649.      (`open-rectangle').  This pushes the previous contents of the
  650.      region-rectangle rightward.
  651. `M-x delete-rectangle'
  652.      Delete the text of the region-rectangle without saving it in any
  653.      special way.
  654. `M-x clear-rectangle'
  655.      Clear the region-rectangle by replacing its contents with spaces.
  656. `M-x string-rectangle RET STRING RET'
  657.      Insert STRING on each line of the region-rectangle.
  658.    The rectangle operations fall into two classes: commands deleting and
  659. inserting rectangles, and commands for blank rectangles.
  660.    There are two ways to get rid of the text in a rectangle: you can
  661. discard the text (delete it) or save it as the "last killed" rectangle.
  662. The commands for these two ways are `M-x delete-rectangle' and `C-x r
  663. k' (`kill-rectangle').  In either case, the portion of each line that
  664. falls inside the rectangle's boundaries is deleted, causing following
  665. text (if any) on the line to move left into the gap.
  666.    Note that "killing" a rectangle is not killing in the usual sense;
  667. the rectangle is not stored in the kill ring, but in a special place
  668. that can only record the most recent rectangle killed.  This is because
  669. yanking a rectangle is so different from yanking linear text that
  670. different yank commands have to be used and yank-popping is hard to
  671. make sense of.
  672.    Yanking a rectangle is the opposite of killing one.  Point specifies
  673. where to put the rectangle's upper left corner.  The rectangle's first
  674. line is inserted there, the rectangle's second line is inserted at a
  675. point one line vertically down, and so on.  The number of lines affected
  676. is determined by the height of the saved rectangle.
  677.    To yank the last killed rectangle, type `C-x r y'
  678. (`yank-rectangle').  This can be used to convert single-column lists
  679. into double-column lists; kill the second half of the list as a
  680. rectangle and then yank it beside the first line of the list.
  681.    You can also copy rectangles into and out of registers with `C-x r r
  682. R' and `C-x r i R'.  *Note Rectangle Registers: RegRect.
  683.    The command `M-x string-rectangle' is similar to `C-x r o', but it
  684. inserts a specified string instead of blanks.  You specify the string
  685. with the minibuffer.  Since the length of the string specifies how many
  686. columns to insert, the width of the region-rectangle does not matter
  687. for this command.  What does matter is the position of the left edge
  688. (which specifies the column position for the insertion in each line)
  689. and the range of lines that the rectangle occupies.  The previous
  690. contents of the text after the insertion column are pushed rightward.
  691.    There are two commands for making with blank rectangles: `M-x
  692. clear-rectangle' to blank out existing text, and `C-x r o'
  693. (`open-rectangle') to insert a blank rectangle.  Clearing a rectangle
  694. is equivalent to deleting it and then inserting a blank rectangle of
  695. the same size.
  696. File: emacs,  Node: Registers,  Next: Display,  Prev: Rectangles,  Up: Top
  697. Registers
  698. *********
  699.    Emacs "registers" are places you can save text or positions for
  700. later use.  Text and rectangles saved in registers can be copied into
  701. the buffer once or many times; you can move point to a position saved in
  702. a register.
  703.    Each register has a name which is a single character.  A register can
  704. store a piece of text, a rectangle, a position, a window configuration
  705. or a file name, but only one thing at any given time.  Whatever you
  706. store in a register remains there until you store something else in that
  707. register.  To see what a register R contains, use `M-x view-register'.
  708. `M-x view-register RET R'
  709.      Display a description of what register R contains.
  710. * Menu:
  711. * Position: RegPos.           Saving positions in registers.
  712. * Text: RegText.              Saving text in registers.
  713. * Rectangle: RegRect.         Saving rectangles in registers.
  714. * Configurations: RegConfig.  Saving window configurations in registers.
  715. * Files: RegFiles.            File names in registers.
  716. File: emacs,  Node: RegPos,  Next: RegText,  Up: Registers
  717. Saving Positions in Registers
  718. =============================
  719.    Saving a position records a spot in a buffer so that you can move
  720. back there later.  Moving to a saved position reselects that buffer and
  721. moves point to that spot.
  722. `C-x r SPC R'
  723.      Save position of point in register R (`point-to-register').
  724. `C-x r j R'
  725.      Jump to the position saved in register R (`jump-to-register').
  726.    To save the current position of point in a register, choose a name R
  727. and type `C-x r SPC R'.  The register R retains the position thus saved
  728. until you store something else in that register.
  729.    The command `C-x r j R' moves point to the position recorded in
  730. register R.  The register is not affected; it continues to record the
  731. same position.  You can jump to the same position using the same
  732. register any number of times.
  733. File: emacs,  Node: RegText,  Next: RegRect,  Prev: RegPos,  Up: Registers
  734. Saving Text in Registers
  735. ========================
  736.    When you want to insert a copy of the same piece of text several
  737. times, it may be inconvenient to yank it from the kill ring, since each
  738. subsequent kill moves that entry further down the ring.  An alternative
  739. is to store the text in a register with `C-x r s' (`copy-to-register')
  740. and then retrieve it with `C-x r i' (`insert-register').
  741. `C-x r s R'
  742.      Copy region into register R (`copy-to-register').
  743. `C-x r i R'
  744.      Insert text from register R (`insert-register').
  745.    `C-x r s R' stores a copy of the text of the region into the
  746. register named R.  Given a numeric argument, `C-x r s R' deletes the
  747. text from the buffer as well.
  748.    `C-x r i R' inserts in the buffer the text from register R.
  749. Normally it leaves point before the text and places the mark after, but
  750. with a numeric argument (`C-u') it puts point after the text and the
  751. mark before.
  752. File: emacs,  Node: RegRect,  Next: RegConfig,  Prev: RegText,  Up: Registers
  753. Saving Rectangles in Registers
  754. ==============================
  755.    A register can contain a rectangle instead of linear text.  The
  756. rectangle is represented as a list of strings.  *Note Rectangles::, for
  757. basic information on how to specify a rectangle in the buffer.
  758. `C-x r r R'
  759.      Copy the region-rectangle into register R
  760.      (`copy-region-to-rectangle').  With numeric argument, delete it as
  761.      well.
  762. `C-x r i R'
  763.      Insert the rectangle stored in register R (if it contains a
  764.      rectangle) (`insert-register').
  765.    The `C-x r i R' command inserts a text string if the register
  766. contains one, and inserts a rectangle if the register contains one.
  767. File: emacs,  Node: RegConfig,  Next: RegFiles,  Prev: RegRect,  Up: Registers
  768. Saving Window Configurations in Registers
  769. =========================================
  770.    You can save the window configuration of the selected frame in a
  771. register, or even the configuration of all frames, and restore the
  772. configuration later.
  773. `C-x r w R'
  774.      Save the state of the selected frame's windows in register R
  775.      (`window-configuration-to-register').
  776. `C-x r f R'
  777.      Save the state of all windows in all frames in register R
  778.      (`frame-configuration-to-register').
  779.    Use `C-x r j R' to restore a window or frame configuration.  This is
  780. the same command used to restore a cursor position.
  781. File: emacs,  Node: RegFiles,  Prev: RegConfig,  Up: Registers
  782. Keeping File Names in Registers
  783. ===============================
  784.    If you visit certain file names frequently, you can visit them more
  785. conveniently if you put their names in registers.  Here's the Lisp code
  786. used to put a file name in a register:
  787.      (set-register ?R '(file . NAME))
  788. For example,
  789.      (set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog"))
  790. puts the file name shown in register `z'.
  791.    To visit the file whose name is in register R, type `C-x r j R'.
  792. (This is the same command used to jump to a position or restore a frame
  793. configuration.)
  794. File: emacs,  Node: Display,  Next: Search,  Prev: Registers,  Up: Top
  795. Controlling the Display
  796. ***********************
  797.    Since only part of a large buffer fits in the window, Emacs tries to
  798. show the part that is likely to be interesting.  The display control
  799. commands allow you to specify which part of the text you want to see.
  800. `C-l'
  801.      Clear screen and redisplay, scrolling the selected window to center
  802.      point vertically within it (`recenter').
  803. `C-v'
  804.      Scroll forward (a windowful or a specified number of lines)
  805.      (`scroll-up').
  806. `NEXT'
  807.      Likewise, scroll forward.
  808. `M-v'
  809.      Scroll backward (`scroll-down').
  810. `PRIOR'
  811.      Likewise, scroll backward.
  812. `ARG C-l'
  813.      Scroll so point is on line ARG (`recenter').
  814. `C-x <'
  815.      Scroll text in current window to the left (`scroll-left').
  816. `C-x >'
  817.      Scroll to the right (`scroll-right').
  818. `C-x $'
  819.      Make deeply indented lines invisible (`set-selective-display').
  820.    The names of all scroll commands are based on the direction that the
  821. text moves in the window.  Thus, the command to scrolling forward is
  822. called `scroll-up', since the text moves up.
  823. * Menu:
  824. * Scrolling::               Moving text up and down in a window.
  825. * Horizontal Scrolling::   Moving text left and right in a window.
  826. * Selective Display::      Hiding lines with lots of indentation.
  827. * Optional Display::       Optional display features.
  828. * European Display::       Displaying (and inputting) European characters.
  829. * Display Vars::           Information on variables for customizing display.
  830. File: emacs,  Node: Scrolling,  Next: Horizontal Scrolling,  Up: Display
  831. Scrolling
  832. =========
  833.    If a buffer contains text that is too large to fit entirely within a
  834. window that is displaying the buffer, Emacs shows a contiguous portion
  835. of the text.  The portion shown always contains point.
  836.    "Scrolling" means moving text up or down in the window so that
  837. different parts of the text are visible.  Scrolling forward means that
  838. text moves up, and new text appears at the bottom.  Scrolling backward
  839. moves text down and new text appears at the top.
  840.    Scrolling happens automatically if you move point past the bottom or
  841. top of the window.  You can also explicitly request scrolling with the
  842. commands in this section.
  843. `C-l'
  844.      Clear screen and redisplay, scrolling the selected window to center
  845.      point vertically within it (`recenter').
  846. `C-v'
  847.      Scroll forward (a windowful or a specified number of lines)
  848.      (`scroll-up').
  849. `NEXT'
  850.      Likewise, scroll forward.
  851. `M-v'
  852.      Scroll backward (`scroll-down').
  853. `PRIOR'
  854.      Likewise, scroll backward.
  855. `ARG C-l'
  856.      Scroll so point is on line ARG (`recenter').
  857. `C-M-l'
  858.      Scroll heuristically to bring useful information onto the screen
  859.      (`reposition-window').
  860.    The most basic scrolling command is `C-l' (`recenter') with no
  861. argument.  It clears the entire screen and redisplays all windows.  In
  862. addition, it scrolls the selected window so that point is halfway down
  863. from the top of the window.
  864.    The scrolling commands `C-v' and `M-v' let you move all the text in
  865. the window up or down a few lines.  `C-v' (`scroll-up') with an
  866. argument shows you that many more lines at the bottom of the window,
  867. moving the text and point up together as `C-l' might.  `C-v' with a
  868. negative argument shows you more lines at the top of the window.  `M-v'
  869. (`scroll-down') is like `C-v', but moves in the opposite direction.
  870. The function keys NEXT and PRIOR are equivalent to `C-v' and `M-v'.
  871.    To read the buffer a windowful at a time, use `C-v' with no argument.
  872. It takes the last two lines at the bottom of the window and puts them at
  873. the top, followed by nearly a whole windowful of lines not previously
  874. visible.  If point was in the text scrolled off the top, it moves to the
  875. new top of the window.  `M-v' with no argument moves backward with
  876. overlap similarly.  The number of lines of overlap across a `C-v' or
  877. `M-v' is controlled by the variable `next-screen-context-lines'; by
  878. default, it is two.
  879.    Another way to do scrolling is with `C-l' with a numeric argument.
  880. `C-l' does not clear the screen when given an argument; it only scrolls
  881. the selected window.  With a positive argument N, it repositions text
  882. to put point N lines down from the top.  An argument of zero puts point
  883. on the very top line.  Point does not move with respect to the text;
  884. rather, the text and point move rigidly on the screen.  `C-l' with a
  885. negative argument puts point that many lines from the bottom of the
  886. window.  For example, `C-u - 1 C-l' puts point on the bottom line, and
  887. `C-u - 5 C-l' puts it five lines from the bottom.  Just `C-u' as
  888. argument, as in `C-u C-l', scrolls point to the center of the screen.
  889.    The `C-M-l' command (`reposition-window') scrolls the current window
  890. heuristically in a way designed to get useful information onto the
  891. screen.  For example, in a Lisp file, this command tries to get the
  892. entire current defun onto the screen if possible.
  893.    Scrolling happens automatically if point has moved out of the visible
  894. portion of the text when it is time to display.  Usually the scrolling
  895. is done so as to put point vertically centered within the window.
  896. However, if the variable `scroll-step' has a nonzero value, an attempt
  897. is made to scroll the buffer by that many lines; if that is enough to
  898. bring point back into visibility, that is what is done.
  899.